<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            .axisX,
            .axisY {
                stroke: #999;
                stroke-width: 2px;
            }
        </style>
    </head>
    <body>
        <!-- 
            绘制步骤
                1、获取数据
                2、创建svg
                    <svg></svg>
                3、创建坐标系
                    x轴、y轴
                4、坐标提示信息
                5、根据数据绘制条形图
         -->
        <!-- 后台数据 -->
        <script type="text/javascript">
            addEventListener("load", function () {
                let data = [
                    { date: "周一", order: "1000" },
                    { date: "周二", order: "600" },
                    { date: "周三", order: "200" },
                    { date: "周四", order: "400" },
                    { date: "周五", order: "500" },
                    { date: "周六", order: "1200" },
                    { date: "周日", order: "500" },
                ];
                console.log(data);
            });
        </script>
        <!-- 创建svg -->
        <svg width="1000" height="700" style="background: cyan">
            <!-- 坐标轴 -->
            <g id="myCoordinate">
                <!-- X轴 -->
                <line class="axisX" x1="50" y1="600" x2="950" y2="600"></line>
                <!-- 箭头 -->
                <path d="M 925,595 L 950,600 L 925,605"></path>
                <!-- 文字 -->
                <text x="910" y="625">时间</text>

                <!-- Y轴 -->
                <line class="axisY" x1="100" y1="650" x2="100" y2="50"></line>
                <path d="M 95,75 L 100,50 L 105,75"></path>
                <text x="55" y="80">订单</text>
            </g>
            <!-- 刻度：X -->
            <g id="myCalibrations">
                <line class="axisX" x1="170" y1="600" x2="170" y2="580"></line>
            </g>
            <!-- 刻度：Y -->
            <!-- 条形图 -->
        </svg>
    </body>
</html>
